#set(title="人事管理")
#@layout()

#define body()
<div class="layui-tab layui-tab-brief tab" lay-filter="tab">
    <ul class="layui-tab-title">
        <li>人员</li>
        <li class="layui-this">部门</li>
        <li>调动</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-main">
            <div style="margin-top: 15px">
                <form action="" class="layui-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label">部门编号</label>
                        <div class="layui-input-inline">
                            <input autocomplete="off" class="layui-input" lay-verify="number" name="id"
                                   placeholder="请输入部门编号" type="text">
                        </div>
                        <button class="layui-btn" lay-filter="search" lay-submit>搜索</button>

                        #if(manager)
                        <button class="layui-btn layui-btn-normal new-emp" id="newDepartment">新增部门</button>
                        #end
                    </div>
                </form>
            </div>

            <fieldset class="layui-elem-field layui-field-title">
                    <legend>
                        <a>部门信息</a>
                    </legend>
                </fieldset>
                <table id="table" lay-filter="department-table"></table>
        </div>

    </div>
</div>


#end

#define css()
<link rel="stylesheet" href="/assets/css/emp.css">
#end


#define js()
<script src="/assets/js/department.js"></script>
#end

<script type="text/html" id="barDemo">
    #if(manager)
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    #else

    <a class="layui-btn layui-btn-xs" lay-event="access">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="access">删除</a>
    #end
</script>


<form class="layui-form new-emp-form" action="" id="newDepartmentForm" lay-filter="newDepartmentForm">
    <div class="layui-form-item">
        <label class="layui-form-label">部门名称</label>
        <div class="layui-input-block">
            <input type="text" id="dName" name="dName" required lay-verify="required" placeholder="请输入部门名"
                   autocomplete="off"
                   class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">部门职责</label>
        <div class="layui-input-block">
            <input type="text" name="mission" placeholder="请输入部门职责" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="remarks" placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">部门经理</label>
        <div class="layui-input-inline">
            <input type="text" name="manager" id="manager" placeholder="请输入员工编号" lay-verify="number" value="0"
                   autocomplete="off"
                   class="layui-input">
        </div>

        <div class="layui-form-mid layui-word-aux" id="explain">请输入在职员工员工编号,若暂无经理，请填0</div>
    </div>

    <input name="id" hidden>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" id="newSubmit" lay-submit lay-filter="newDepartmentSubmit">立即提交</button>
            <button class="layui-btn" id="editSubmit" lay-submit lay-filter="editDepartmentSubmit">立即提交</button>
            <!--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
        </div>
    </div>
</form>